﻿using EfDomain.Entities;
using EfInfra;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EfLearn.Uniter
{
    public class Adder
    {
        public static void Simple()
        {
            var db = DI.InsProvider.GetService<MyContext>();
            var cat = new Category()
            {
                Name = "aaa",
                Products = new List<Product>()
                {
                    new Product {Name="P1",UnitPrice=100},
                    new Product {Name="P2",UnitPrice=200},
                    new Product {Name="P3",UnitPrice=500},
                }
            };
            db.Category.Add(cat);
            db.SaveChanges();
        }
    }
}
